package com.gtvtv.sparkdesksdk.model.request.agent;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@JsonInclude(JsonInclude.Include.NON_NULL)
public class AgentRequestBody {
    @JsonProperty("flow_id")
    private String flowId;

    @JsonProperty("uid")
    private String uid;

    @JsonProperty("stream")
    private boolean stream;

    @JsonProperty("ext")
    private Map<String, Object> ext;

    @JsonProperty("parameters")
    private Map<String, Object> parameters;

    @JsonProperty("chat_id")
    private String chatId;

    @JsonProperty("history")
    private List<AgentRequestHistoryMessageObject> history;

    public AgentRequestBody(String flowId, Map<String, Object> parameters, boolean stream) {
        this.flowId = flowId;
        this.parameters = parameters;
        this.stream = stream;
        this.history = new ArrayList<>();
        this.ext = new HashMap<>();
    }

    public void addHistoryMessage(AgentRequestHistoryMessageObject message) {
        if (history == null) {
            history = new ArrayList<>();
        }
        history.add(message);
    }

    // Getters and Setters
    public String getFlowId() {
        return flowId;
    }

    public void setFlowId(String flowId) {
        this.flowId = flowId;
    }

    public String getUid() {
        return uid;
    }

    public void setUid(String uid) {
        this.uid = uid;
    }

    public boolean isStream() {
        return stream;
    }

    public void setStream(boolean stream) {
        this.stream = stream;
    }

    public Map<String, Object> getExt() {
        return ext;
    }

    public void setExt(Map<String, Object> ext) {
        this.ext = ext;
    }

    public Map<String, Object> getParameters() {
        return parameters;
    }

    public void setParameters(Map<String, Object> parameters) {
        this.parameters = parameters;
    }

    public String getChatId() {
        return chatId;
    }

    public void setChatId(String chatId) {
        this.chatId = chatId;
    }

    public List<AgentRequestHistoryMessageObject> getHistory() {
        return history;
    }

    public void setHistory(List<AgentRequestHistoryMessageObject> history) {
        this.history = history;
    }
}
